/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.polytec.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Felix
 */
@Entity
@Table(name = "historique_du_panier")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoriqueDuPanier.findAll", query = "SELECT h FROM HistoriqueDuPanier h"),
    @NamedQuery(name = "HistoriqueDuPanier.findByIdHisto", query = "SELECT h FROM HistoriqueDuPanier h WHERE h.idHisto = :idHisto"),
    @NamedQuery(name = "HistoriqueDuPanier.findByEtat", query = "SELECT h FROM HistoriqueDuPanier h WHERE h.etat = :etat")})
public class HistoriqueDuPanier implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_histo")
    private Integer idHisto;
    @Basic(optional = false)
    @NotNull
    @Column(name = "etat")
    private boolean etat;
    @OneToMany(mappedBy = "idHisto")
    private List<Panier> panierList;

    public HistoriqueDuPanier() {
    }

    public HistoriqueDuPanier(Integer idHisto) {
        this.idHisto = idHisto;
    }

    public HistoriqueDuPanier(Integer idHisto, boolean etat) {
        this.idHisto = idHisto;
        this.etat = etat;
    }

    public Integer getIdHisto() {
        return idHisto;
    }

    public void setIdHisto(Integer idHisto) {
        this.idHisto = idHisto;
    }

    public boolean getEtat() {
        return etat;
    }

    public void setEtat(boolean etat) {
        this.etat = etat;
    }

    @XmlTransient
    public List<Panier> getPanierList() {
        return panierList;
    }

    public void setPanierList(List<Panier> panierList) {
        this.panierList = panierList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHisto != null ? idHisto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoriqueDuPanier)) {
            return false;
        }
        HistoriqueDuPanier other = (HistoriqueDuPanier) object;
        if ((this.idHisto == null && other.idHisto != null) || (this.idHisto != null && !this.idHisto.equals(other.idHisto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.polytec.entities.HistoriqueDuPanier[ idHisto=" + idHisto + " ]";
    }
    
}
